<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>后台管理系统</title>
    <meta name="referrer" content="no-referrer">
    <link rel="stylesheet" href="https://at.alicdn.com/t/c/font_4755950_cmhps6g8f.css">
    <link rel="stylesheet" href="../style/common.css">
</head>

<body>
    <header class="bg-base flex aic pl-20">
        <h3 class="fff">果莱人才网后台管理系统</h3>
    </header>

    <main class="bg-fff" style="margin-left: 0;">
        <div class="pl-30 mb-20 flex jc-sb pr-30">
            <span>修改职位</span>
            <!-- <span class="base cursor">添加</span> -->
        </div>
        <div class="ml-30 form">
            <p class="item mt-10">
                <span>工作名称 </span>
                <input id="workTitle" type="text" class="ml-10" placeholder="请输入" >
            </p>
            <p class="item mt-10">
                <span>薪资</span>
                <input id="price" type="text" class="ml-10" placeholder="请输入" >
            </p>
            <p class="item mt-10">
                <span>发布时间</span>
                <input id="time" type="text" class="ml-10" placeholder="请输入" >
            </p>
  
            <p class="item mt-10">
                <span>工作地址</span>
                <input id="conditionAddress" type="text" class="ml-10" placeholder="请输入" >
            </p>
            <p class="item mt-10">
                <span>工作经验</span>
                <input id="conditionExperience" type="text" class="ml-10" placeholder="请输入" >
            </p>
            <p class="item mt-10">
                <span>学历要求</span>
                <input id="conditionEdu" type="text" class="ml-10" placeholder="请输入" >
            </p>
            <p class="item mt-10">
                <span>公司</span>
                <input id="companyName" type="text" class="ml-10" placeholder="请输入" >
            </p>
           
            <p class="item mt-10">
                <span>工作要求</span>
                <input id="jobDetails" type="text" class="ml-10" placeholder="请输入" >
            </p>
            <p class="item mt-10">
                <span>公司logo</span>
                <input id="imgUrl" type="text" class="ml-10" placeholder="请输入图片地址"
                    value="https://assets2.myjiedian.com/mobile-v2/beta/assets/default_company_logo-718ee4ef.png">
            </p>

            <p class="item mt-30 ml-30 pl-25">
                <button id="submit" class="btn submit ml-30">修改</button>
            </p>
        </div>

    </main>


    <script src="../js/jquery.js"></script>
    <script src="../js/axios.js"></script>
    <script src="../js/common.js"></script>
    <script>
      var editObj ={
        editData() {
        $('#submit').click(function(){
            var webUrl = location.href;
        var index = webUrl.indexOf("=");
        var id = webUrl.slice(index + 1);
        // 删除数据
        var url = 'http://localhost:3000/apply/'+id;
        if($('input').val() == ''){
            alert('请输入完整信息')
        }else{
            var data = {
                    imgUrl: $('#imgUrl').val(),
                    workTitle: $('#workTitle').val(),
                    price: $('#price').val(), 
                    companyName: $('#companyName').val(), 
                    jobDetails: $('#jobDetails').val(),  
                    conditionAddress: $('#conditionAddress').val(),  
                    conditionExperience: $('#conditionExperience').val(),  
                    conditionEdu: $('#conditionEdu').val(),  
                    time: $('#time').val(),
            // 更新时间
            uTime: Date.now()
        }
        axios.patch(url,data).then(function (res) {
            console.log(res);
        })
        location.href = './list.html';
        alert('修改成功');
        }
        })
        
    }
       
      }
      editObj.editData();
    </script>
    </body>
   </html>